﻿@{
    ViewBag.Title = "Ztree";
    Layout = "~/Views/Shared/_LayoutEdit.cshtml";
}

<ul id="treeDemo" class="ztree"></ul>
<script type="text/javascript">

    var setting = {

        async: {
            enable: true,
            url: "/CodeData/ZtreeData",
            autoParam: ["id=type"],
            dataFilter: filter
        }

    };

    function filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }


    $(document).ready(function () {
        $.fn.zTree.init($("#treeDemo"), setting);
//        $.ajaxC({
//            url: "/CodeData/ZtreeData",
//            success: function (data) {
//                $.fn.zTree.init($("#treeDemo"), setting, data.Attr);
//            }
//        });
    });



</script>
